package com.cheyun.netsalev3.utils.api

import com.cheyun.netsalev3.bean.ChannelListParam
import com.cheyun.netsalev3.bean.dm.*
import io.reactivex.Observable

import retrofit2.http.*

/**
 * @author Michael
 * @date  2018/11/6 - 15:24.
 */
interface DmApiStores {
    companion object {

        const val NOTICE_APP_ID = "10001"
        const val NOTICE_APP_KEY = "703b5acb3468e1736ca4461bc08b8c84"
        const val NOTICE_API_SERVER_URL = "https://isiteimg.new4s.com/qualitycheck/push/"

        //测试服
        const val API_SERVER_URL = "http://proxy.adm.new4s.com/"
        //正式服
//        const val API_SERVER_URL = "http://api.adm.new4s.com/"

        const val KEY = "X4Ya0"

        const val PAGE_SIZE = 20
    }

    //登陆
    @FormUrlEncoded
    @POST("adm-login/distributor/app")
    fun login(@Field("mobile") mobile: String,@Field("password") password: String, @Field("channel") channel: Int): Observable<DmBaseResp<DmLogin,Any>>

    @GET("adm-mobile/v1.0/clue/page")
    fun getClue(@Query("params") params: String,@Query("pageIndex") pageIndex :Int,@Query("pageSize") pageSize:Int):Observable<DmBaseResp<DmClue,Any>>

    @GET("adm-mobile/v1.0/clue/page")
    fun getClueDetail(@Query("params") params: String,@Query("pageIndex") pageIndex :Int,@Query("pageSize") pageSize:Int):Observable<DmBaseResp<DmClue, DmLastHistory>>

    @GET("adm-mobile/v1.0/clue/listClueHistory")
    fun getRecords(@Query("clueId") clueId: String): Observable<DmBaseResp<List<DmHistory>,Any>>

    @FormUrlEncoded
    @POST("adm-mobile/v1.0/clue/transfer")
    fun clueTransfer(@Field("clueId") clueId: String,
                    @Field("toUserId") toUserId: String,
                    @Field("toUser") toUser: String,
                    @Field("remark") remark: String
    ): Observable<DmBaseResp<Int,Any>>

    @GET("adm-mobile/v1.0/clue/deal/user/list")
    fun getDealUsers(): Observable<DmBaseResp<List<DmDealUser>,Any>>

    @FormUrlEncoded
    @POST("adm-mobile/v1.0/clue/follow")
    fun clueFollow(@Field("clueId") clueId: String,
                   @Field("status") status: String,
                   @Field("type") type: String,
                   @Field("arrive") arrive: String,
                   @Field("dealTime") dealTime: String,
                   @Field("remark") remark: String
    ): Observable<DmBaseResp<Int,Any>>

    //用户可选经销商列表
    @GET("adm-mobile/v1.0/channel/list")
    fun getChannelmember(): Observable<DmBaseResp<List<ChannelListParam>,Any>>

    //切换经销商
    @GET("adm-mobile/v1.0/channel/switch")
    fun getChannelchange(@Query("channel") channel: Int): Observable<DmBaseResp<Any,Any>>

    @GET("adm-mobile/v1.0/clue/callphone")
    fun callPhone(@Query("clueId") channel: Int): Observable<DmBaseResp<String,Any>>

    //通话记录列表
    @GET("adm-mobile/v1.0/clue/listClueHistoryMp3List")
    fun getCallphoneList(@Query("logId") logId: Int): Observable<DmBaseResp<List<DmHistory>,Any>>

    //客服聊天列表心跳
    @FormUrlEncoded
    @POST("adm-mobile/v1.0/wx/kefu/running/active")
    fun kefuRunningActive(@Field("phone") phone: String,
                     @Field("customPhone") customPhone: String
    ): Observable<DmBaseResp<Any,Any>>

    //客服勿扰
    @FormUrlEncoded
    @POST("adm-mobile/v1.0/wx/kefu/busy")
    fun kefuBusy(@Field("username") username: String,
                          @Field("status") status: String
    ): Observable<DmBaseResp<Any,Any>>

    //客服勿扰信息
    @FormUrlEncoded
    @POST("adm-mobile/v1.0/wx/kefu/busy/info")
    fun kefuBusyInfo(@Field("username") username: String
    ): Observable<DmBaseResp<Any,Any>>

    //客服加入聊天列表
    @FormUrlEncoded
    @POST("adm-mobile/v1.0/wx/kefu/running/add")
    fun kefuRunningAdd(@Field("phone") phone: String,
                          @Field("customPhone") customPhone: String
    ): Observable<DmBaseResp<Any,Any>>

    //客服移除聊天列表
    @FormUrlEncoded
    @POST("adm-mobile/v1.0/wx/kefu/running/del")
    fun kefuRunningDel(@Field("phone") phone: String
    ): Observable<DmBaseResp<Any,Any>>

    //客服列表
    @GET("adm-mobile/v1.0/wx/kehu/channel/list")
    fun getKefuList(@Query("kefuPhone") kefuPhone: String,@Query("channelId") channelId: Int): Observable<DmBaseResp<List<DmKefu>,Any>>

    //厂商通道注册别名
    @FormUrlEncoded
    @POST("alias/set")
    fun setFactoryAlias(@Field("appId") appId: String,@Field("appKey") appKey: String,
                        @Field("factoryCode") factoryCode: String,@Field("alias") alias: String,
                        @Field("regId") regId: String
    ): Observable<DmBaseResp<Any,Any>>

    //厂商通道删除别名
    @FormUrlEncoded
    @POST("alias/delete")
    fun deleteFactoryAlias(@Field("appId") appId: String,@Field("appKey") appKey: String,
                        @Field("factoryCode") factoryCode: String,@Field("alias") alias: String
    ): Observable<DmBaseResp<Any,Any>>

}